//
//  XKLPushGiudeView.m
//  GuiZiShouDuanZi
//
//  Created by xmg on 16/4/29.
//  Copyright © 2016年 xiao_kl. All rights reserved.
//

#import "XKLPushGiudeView.h"

#define VERSION @"boxVersion"

@interface XKLPushGiudeView()


@end

@implementation XKLPushGiudeView

-(void)awakeFromNib{
    
}
+(void)show{
    
    //获取当前版本
    NSString *currentV=[NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
    
    //获取沙盒里面的版本
    NSString *saveV=[[NSUserDefaults standardUserDefaults] objectForKey:VERSION];
    
    //判断两个版本是否相同
    if (![currentV isEqualToString:saveV]) {//不相同
        XKLPushGiudeView *pushView=[[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
        pushView.frame=[UIScreen mainScreen].bounds;
        [[UIApplication sharedApplication].keyWindow addSubview:pushView];
        
        //存入
        [[NSUserDefaults standardUserDefaults] setObject:currentV forKey:VERSION];
    }
    
}
- (IBAction)butClick:(id)sender {
    
    [self removeFromSuperview];
}
@end
